package com.tos.second.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.tos.second.entity.Category;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface CategoryMapper extends BaseMapper<Category> {

    @Select("select * from category where status = 1 order by sort")
    List<Category> getList();

    void saveCategory(Category category);

    @Select("select * from category where id = #{id}")
    Category getCategoryById(Long id);

    @Delete("delete from category where id = #{id}")
    void deleteCategoryById(Long id);


}
